<?php
/**
 * Created by PhpStorm.
 * User: linux
 * Date: 12/01/2018
 * Time: 1:10 PM
 */

namespace Criteria\Criteria;


class CriteriaMale implements Criteria
{
    /**
     * 过滤 剩下男性
     * @param array $persons
     * @return mixed
     */
    function meetCriteria(array $persons) : array
    {
        $malePersons = [];
        foreach ($persons as $person) {
            if ($person->getGender() == 'MALE') {
                $malePersons[] = $person;
            }
        }
        return $malePersons;
    }
}